package net.xuele.learn.IO.fakeAio;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * Created by GaoQingming on 2019/4/10 0010.
 */
public class TimeServerHandlerExecutorPool {
    private ExecutorService executor;

    public TimeServerHandlerExecutorPool(int maxSize,int queueSize) {
        executor = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(),maxSize,120L, TimeUnit.SECONDS,new LinkedBlockingQueue<Runnable>(queueSize));
    }

    public void execute (Runnable task) {
        executor.execute(task);
    }
}
